package com.resttest.ljs.controller;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Slf4j
@RequestMapping("/Nginx")
public class NginxTestController {


    @RequestMapping("/jsNginx1")
    @ResponseBody
    public String jieshou1(@RequestBody JSONObject jsonObject){
        JSONObject jsonObject1=new JSONObject();
        try {
            log.info("接收报文：{}",jsonObject.toJSONString());
            jsonObject1.put("msg","成功,第一个接口");
            log.info("返回报文：{}",jsonObject1.toJSONString());
            return jsonObject1.toJSONString();
        }catch (Exception e){
            jsonObject1.put("msg","失败");
            return jsonObject1.toJSONString();
        }
    }

    @RequestMapping("/jsNginx2")
    @ResponseBody
    public String jieshou2(@RequestBody JSONObject jsonObject){
        JSONObject jsonObject1=new JSONObject();
        try {
            log.info("接收报文：{}",jsonObject.toJSONString());
            jsonObject1.put("msg","成功，第二个接口");
            log.info("返回报文：{}",jsonObject1.toJSONString());
            return jsonObject1.toJSONString();
        }catch (Exception e){
            jsonObject1.put("msg","失败");
            return jsonObject1.toJSONString();
        }
    }
}
